package com.aholu.model;

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;


/**
 * 
 * @author aholu
 *
 */
@javax.persistence.Entity
@Table(name = "Users", uniqueConstraints = { @UniqueConstraint(columnNames = "USER_NAME") })
public class User implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	private Long userId;
	private String userName;
	private String name;
	private String surName;
	private Date date;
	private String email;
	private String password;
	private String role;
	

	public User() {
	}
	
	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	
	@Column(name = "ROLE", unique = false, nullable = false)
	public String getRole() {
		return role;
	}

	public void setRole(String role) {
		this.role = role;
	}
	

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "USER_ID", unique = true, nullable = false)
	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	@Column(name = "USER_NAME", unique = true, nullable = false, length = 20)
	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	@Column(name = "FIRST_NAME", unique = false, nullable = false, length = 20)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "SURNAME", unique = false, nullable = false, length = 20)
	public String getSurName() {
		return surName;
	}

	public void setSurName(String surName) {
		this.surName = surName;
	}
	
	@Temporal(TemporalType.DATE)
	@Column(name = "BIRHT_DATE", unique = false, nullable = false)
	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	@Column(name = "EMAIL", unique = true, nullable = false)
	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "PASSWORD", unique = false, nullable = false, length = 30)
	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Override
	public String toString() {
		return "User [userId=" + userId + ", userName=" + userName + ", name=" + name + ", surName=" + surName + ", date=" + date + ", email=" + email + ", password=" + password
				+ ", role=" + role + "]";
	}

}
